package cn.iocoder.yudao.module.example.dao.service.jooq;

import cn.iocoder.yudao.module.example.dao.service.IDAOExampleService;
import jakarta.annotation.Resource;
import org.jooq.*;
import org.jooq.impl.DSL;
import org.springframework.stereotype.Service;

import static org.jooq.impl.DSL.*;

import java.util.List;
import java.util.Map;

@Service(value = "JooqDAOExampleServiceImpl")
public class JooqDAOExampleServiceImpl implements IDAOExampleService {
    @Resource
    private DSLContext dslContext;

    @Override
    public List<Map<String, Object>> testQuery() {
        Condition condition = DSL.trueCondition(); // 创建一个初始条件
        condition = condition.and(field(name("id")).eq("15"));

        final List<Map<String, Object>> rows = dslContext.select()
                .from(table(name("member_user")))
                .where(condition)
                .fetchMaps();

        return rows;
    }

}
